﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="info.aspx.cs" Inherits="JYJJ.Web.Pages.info" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>项目捐赠</title>
    <link href="../js/layui/css/layui.css" rel="stylesheet" />
    <link href="../js/city/index.css" rel="stylesheet" />
    <link href="../css/reset.css" rel="stylesheet" type="text/css" />
    <link href="../css/base_siva.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script type="text/javascript" src="../js/city/citydata.min.js"></script>
    <script type="text/javascript" src="../js/city/cityPicker-2.0.0.js"></script>
    <style type="text/css">
        .blur {
            border: 1px solid red;
        }
    </style>
</head>
<body>

    <div class="bgmain_i clear">
        <div class="wraper_c">
            <div class="main_con clear">
                <h3 class="title_con">项目捐赠</h3>
            </div>
            <table class="table_enter">
                <tbody>
                    <tr style="border: none;">
                        <th style="width: 140px;" rowspan="3">
                            <asp:Image ID="imgUrl" runat="server" BorderStyle="None" Width="140" />
                        </th>

                        <th>
                            <asp:Literal ID="ltTitle" runat="server"></asp:Literal></th>
                    </tr>
                    <tr>
                        <th>
                            <asp:Literal ID="ltDesc" runat="server"></asp:Literal></th>
                    </tr>
                    <tr style="border-bottom: none;">
                        <th>
                            <asp:Literal ID="ltAmount" runat="server"></asp:Literal>
                            <%--￥10元--%>
                        </th>
                    </tr>

                </tbody>
            </table>

            <form name="detail" id="detail">
                <table class="table_enter">
                    <thead>
                        <tr>
                            <th>是否需要捐赠收据</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr style="border-bottom: none;">
                            <td>

                                <label>
                                    <input type="radio" name="rdo_sj" value="1" runat="server" id="rdo_sj_1" />&nbsp;是（请填妥您的联系地址，以便收据准确到达您的手中）</label>
                                <br />
                                <br />
                                <label>
                                    <input type="radio" name="rdo_sj" value="0" checked runat="server" id="rdo_sj_0" />&nbsp;否（基金会将为您保管已开具的收据，您可随时索要）</label>

                            </td>
                        </tr>

                    </tbody>
                </table>
                <table class="table_enter">
                    <colgroup>
                        <col width="12%">
                        <col width="40%">
                        <col width="12%">
                        <col width="">
                    </colgroup>
                    <thead>
                        <tr>
                            <th colspan="4">请填写您的个人信息</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <th>姓名：</th>
                            <td>
                                <input type="text" name="name" id="name" class="input_text_80" value="" runat="server" /></td>
                            <td colspan="2">
                                <label>
                                    <input type="radio" name="rdo_sex" id="rdo_sex_1" value="1" checked runat="server" />&nbsp;先生</label>
                                &nbsp;&nbsp;
                 
                                <label>
                                    <input type="radio" name="rdo_sex" id="rdo_sex_2" value="2" runat="server" />&nbsp;女生</label>


                                <label>
                                    <input type="checkbox" name="niming" id="niming" value="1" runat="server" />&nbsp;匿名捐赠（在捐赠记录中隐藏您的大名）</label>


                            </td>
                        </tr>
                        <tr>
                            <th>电子邮箱：</th>
                            <td>
                                <input type="text" name="email" id="email" class="input_text_80" value="" runat="server" /></td>
                            <th>手机／电话：</th>
                            <td>
                                <input type="text" name="phone" id="phone" class="input_text_80" value="" runat="server" /></td>
                        </tr>

                        <tr>
                            <th>省市区县：</th>
                            <td colspan="3">
                                <div style="display: none;">
                                    <input style="width: 72px;" type="text" id="province" name="province" class="input_text_com" value="" runat="server" />&nbsp;省&nbsp;&nbsp;				  
                                    <input style="width: 72px;" type="text" id="city" name="city" class="input_text_com" value="" runat="server" />&nbsp;市&nbsp;&nbsp;
					                <input style="width: 72px;" type="text" id="district" name="district" class="input_text_com" value="" runat="server" />&nbsp;区县&nbsp; 
                                </div>
                                <div class="city-picker-selector" id="city-picker-selector2"></div>
                            </td>
                        </tr>
                        <tr>
                            <th>地址／邮编：</th>
                            <td colspan="3">详细地址&nbsp;<input style="width: 270px;" name="Address" id="Address" type="text" class="input_text_com" value="" runat="server" />&nbsp;&nbsp;
					  邮编&nbsp;<input style="width: 72px;" name="zipCode" id="zipCode" type="text" class="input_text_com" value="" runat="server" maxlength="6" />
                            </td>
                        </tr>
                        <tr>
                            <th>是否校友：</th>
                            <td colspan="3">
                                <label>
                                    <input type="radio" name="rdp_xy" id="rdp_xy_1" value="1" checked runat="server" />&nbsp;是</label>
                                &nbsp;&nbsp;
                                <label>
                                    <input type="radio" name="rdp_xy" id="rdp_xy_0" value="0" runat="server" />&nbsp;否</label>
                            </td>
                        </tr>

                        <%--<tr>
                        <th>下拉框：</th>
                        <td>
                            <select class="input_sel_80">

                                <option>请选择</option>

                            </select>

                        </td>
                        <th></th>
                        <td></td>
                    </tr>
                    <tr style="border-bottom: none;">
                        <th valign="top">文本区域：</th>
                        <td colspan="3">
                            <textarea class="textarea_80"></textarea>
                        </td>

                    </tr>--%>
                    </tbody>
                </table>
                <div class="range_A clear" runat="server" id="divButton">
                    <a href="javascript:void(0);" name="abtnRest" class="btn_com_w fR">重置</a>
                    <a href="javascript:void(0);" class="btn_com_A fR mRight_20">提交捐赠单</a>
                </div>
                <input type="hidden" name="methon" value="save_order" />
                <input type="hidden" name="donateId" id="donateId" value="" runat="server" />
                <input type="hidden" name="PayType" id="PayType" value="" runat="server" />
                <input type="hidden" name="amount" id="amount" value="" runat="server" />
                <input type="hidden" name="count" id="count" value="" runat="server" />
                <input type="hidden" name="Choice" id="Choice" value="" runat="server" />
            </form>
        </div>
    </div>
    <script type="text/javascript">
        function showMsg(Msg, name) {
            layer.open({
                type: 1
               , offset: 'auto'
               , id: 'layerDemo1'
               , content: '<div style="padding: 20px 100px;">' + Msg + '</div>'
               , btn: '关闭'
               , btnAlign: 'c' //按钮居中
               , shade: 0.5 //不显示遮罩
               , yes: function () {
                   layer.closeAll();
                   if (name != "") {
                       $("input[name='" + name + "']").focus();
                       $("input[name='" + name + "']").addClass("blur");
                   }
               }
            });
        }
        // 模拟城市-无联动/无搜索
        var selector2 = $('#city-picker-selector2').cityPicker({
            dataJson: cityData,
            renderMode: true,
            search: false,
            autoSelected: true,
            code: 'cityCode',
            level: 3,
            onChoiceEnd: function () {
                //console.log(this.values)                                           
                var obj = this.values;
                for (var i = 0; i < obj.length; i++) {
                    if (i == 0) {
                        $("#province").val(obj[i].name);
                    }
                    else if (i == 1) {
                        $("#city").val(obj[i].name);
                    }
                    else if (i == 2) {
                        $("#district").val(obj[i].name);
                    }
                }
            }
        });
        $(document).ready(function () {
            if ($("#province").val() != "") {
                selector2.setCityVal($("#province").val() + "," + $("#city").val() + "," + $("#district").val());
            }
            //:input 获取的是 type=text,radio,button等select textarea等元素对象  
            $(":input").blur(function () { //注册blur的事件  
                $(this).each(function () { //遍历input元素对象   
                    if ("" == $(this).val()) { //判断元素对象的value值  
                        $(this).addClass("blur"); //添加css样式  
                    } else {
                        $(this).removeClass("blur");
                    }
                });
            });

            $('.btn_com_w').click(function () {
                window.location.reload();
            });
            $('.btn_com_A').click(function () {
                var name = $("input[name='name']").val();
                if (name == "") {
                    showMsg("姓名不能为空", "name");
                    return false;
                }
                var email = $("input[name='email']").val();
                if (email == "") {
                    showMsg("邮箱不能为空", "email");
                    return false;
                }
                var phone = $("input[name='phone']").val();
                if (phone == "") {
                    showMsg("手机电话不能为空", "phone");
                    return false;
                }
                if (selector2.getCityVal() == "") {
                    showMsg("请先选择省市区县");
                    return false;
                }
                var Address = $("input[name='Address']").val();
                if (Address == "") {
                    showMsg("详细地址不能为空", "Address");
                    return false;
                }
                var zipCode = $("input[name='zipCode']").val();
                if (zipCode == "") {
                    showMsg("邮编不能为空", "zipCode");
                    return false;
                }
                var data = $("#detail").serialize();
                $.ajax('../Handlers/Handlers_Order.ashx', {
                    data: data,
                    dataType: 'json', //服务器返回json格式数据
                    type: 'post', //HTTP请求类型
                    beforeSend: function () {
                        layer.msg('加载中', { icon: 16, shade: 0.01 });
                    },
                    success: function (data) {
                        layer.closeAll('loading');
                        if (data.State == "true") {
                            window.location = "payQR.aspx?donateId=" + data.RetCode + "&orderId=" + data.RetData;
                        }
                        else {
                            showMsg(data.Message);
                        }
                    },
                    error: function (xhr, type, errorThrown) {
                        layer.closeAll('loading');
                        showMsg("网络错误");
                    }
                });
            });
        });
       
    </script>
    <script src="../js/layui/layui.all.js"></script>
</body>
</html>
